home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / Utilities / TempIter.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  6.8 KB  |  356 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TempIter.cpp
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Doug Hill
  7.  
  8.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     7/26/96    DH        Fixed iterator classes that descend from
  13.                                     BaseTempObj to initialize their member
  14.                                     object to null before allocation.
  15.  
  16.     To Do:
  17. */
  18.  
  19. /*
  20.     File:        TempIter.cpp
  21.  
  22.     Contains:    Template utilities for OpenDoc iterators
  23.  
  24.     Owned by:    Jens Alfke
  25.  
  26.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  27.  
  28. */
  29.  
  30.  
  31. #ifndef SOM_ODDragAndDrop_xh
  32. #include <DragDrp.xh>
  33. #endif
  34.  
  35. #ifndef _TEMPITER_
  36. #include "TempIter.h"
  37. #endif
  38.  
  39. #ifndef SOM_ODFrame_xh
  40. #include <Frame.xh>
  41. #endif
  42.  
  43. #ifndef SOM_ODFacet_xh
  44. #include <Facet.xh>
  45. #endif
  46.  
  47. #ifndef SOM_ODFacetIterator_xh
  48. #include <FacetItr.xh>
  49. #endif
  50.  
  51. #ifndef SOM_ODEmbeddedFramesIterator_xh
  52. #include <EmbFrItr.xh>
  53. #endif
  54.  
  55. #ifndef SOM_ODFrameFacetIterator_xh
  56. #include <FrFaItr.xh>
  57. #endif
  58.  
  59. #ifndef SOM_ODWindowState_xh
  60. #include <WinStat.xh>
  61. #endif
  62.  
  63. #ifndef SOM_ODWindowIterator_xh
  64. #include <WinIter.xh>
  65. #endif
  66.  
  67. #ifdef _OD_IMPL_
  68. #ifndef SOM_ODDragAndDrop_xh
  69. #include <DragDrp.xh>
  70. #endif
  71.  
  72. #ifndef SOM_ODDragItemIterator_xh
  73. #include <DgItmIt.xh>
  74. #endif
  75. #endif
  76.  
  77. #ifndef SOM_ODFocusSet_xh
  78. #include <FocusSet.xh>
  79. #endif
  80.  
  81. #ifndef SOM_ODFocusSetIterator_xh
  82. #include <FocusItr.xh>
  83. #endif
  84.  
  85. #ifndef SOM_ODTypeList_xh
  86. #include <TypeList.xh>
  87. #endif
  88.  
  89. #ifndef SOM_ODTypeListIterator_xh
  90. #include <TypLsItr.xh>
  91. #endif
  92.  
  93. #ifndef _ODMEMORY_
  94. #include "ODMemory.h"
  95. #endif
  96.  
  97. //=====================================================================================
  98. // TempODFacetIterator
  99. //=====================================================================================
  100.  
  101. TempODFacetIterator::TempODFacetIterator( Environment *ev, ODFacet *fa,
  102.                                           ODTraversalType tt, ODSiblingOrder so )
  103.     :BaseTempObj(),
  104.      fEv(ev)
  105. {
  106.     fObj = kODNULL;
  107.     fObj = fa->CreateFacetIterator(ev,tt,so);
  108.     this->First();
  109. }
  110.  
  111.  
  112. ODFacet*
  113. TempODFacetIterator::First( )
  114. {
  115.     return fCurrent = ((ODFacetIterator*)fObj)->First(fEv);
  116. }
  117.  
  118.  
  119. ODFacet*
  120. TempODFacetIterator::Next( )
  121. {
  122.     return fCurrent = ((ODFacetIterator*)fObj)->Next(fEv);
  123. }
  124.  
  125.  
  126. ODBoolean
  127. TempODFacetIterator::IsNotComplete( )
  128. {
  129.     return ((ODFacetIterator*)fObj)->IsNotComplete(fEv);
  130. }
  131.  
  132.  
  133. //=====================================================================================
  134. // TempODFrameFacetIterator
  135. //=====================================================================================
  136.  
  137. TempODFrameFacetIterator::TempODFrameFacetIterator( Environment *ev, ODFrame *fr )
  138.     :BaseTempObj(),
  139.      fEv(ev)
  140. {
  141.     fObj = kODNULL;
  142.     fObj = fr->CreateFacetIterator(ev);
  143.     this->First();
  144. }
  145.  
  146.  
  147. ODFacet*
  148. TempODFrameFacetIterator::First( )
  149. {
  150.     return fCurrent = ((ODFrameFacetIterator*)fObj)->First(fEv);
  151. }
  152.  
  153.  
  154. ODFacet*
  155. TempODFrameFacetIterator::Next( )
  156. {
  157.     return fCurrent = ((ODFrameFacetIterator*)fObj)->Next(fEv);
  158. }
  159.  
  160.  
  161. ODBoolean
  162. TempODFrameFacetIterator::IsNotComplete( )
  163. {
  164.     return ((ODFrameFacetIterator*)fObj)->IsNotComplete(fEv);
  165. }
  166.  
  167.  
  168. //=====================================================================================
  169. // TempODEmbeddedFramesIterator
  170. //=====================================================================================
  171.  
  172. TempODEmbeddedFramesIterator::TempODEmbeddedFramesIterator( Environment *ev,
  173.                                                             ODPart *part, ODFrame *fr )
  174.     :BaseTempObj(),
  175.      fEv(ev)
  176. {
  177.     fObj = kODNULL;
  178.     fObj = part->CreateEmbeddedFramesIterator(ev,fr);
  179.     this->First();
  180. }
  181.  
  182.  
  183. ODFrame*
  184. TempODEmbeddedFramesIterator::First( )
  185. {
  186.     return fCurrent = ((ODEmbeddedFramesIterator*)fObj)->First(fEv);
  187. }
  188.  
  189.  
  190. ODFrame*
  191. TempODEmbeddedFramesIterator::Next( )
  192. {
  193.     return fCurrent = ((ODEmbeddedFramesIterator*)fObj)->Next(fEv);
  194. }
  195.  
  196.  
  197. ODBoolean
  198. TempODEmbeddedFramesIterator::IsNotComplete( )
  199. {
  200.     return ((ODEmbeddedFramesIterator*)fObj)->IsNotComplete(fEv);
  201. }
  202.  
  203.  
  204. //=====================================================================================
  205. // TempODWindowIterator
  206. //=====================================================================================
  207.  
  208. TempODWindowIterator::TempODWindowIterator( Environment *ev, ODWindowState *ws )
  209.     :BaseTempObj(),
  210.      fEv(ev)
  211. {
  212.     fObj = kODNULL;
  213.     fObj = ws->CreateWindowIterator(ev);
  214.     this->First();
  215. }
  216.  
  217.  
  218. ODWindow*
  219. TempODWindowIterator::First( )
  220. {
  221.     return fCurrent = ((ODWindowIterator*)fObj)->First(fEv);
  222. }
  223.  
  224.  
  225. ODWindow*
  226. TempODWindowIterator::Next( )
  227. {
  228.     return fCurrent = ((ODWindowIterator*)fObj)->Next(fEv);
  229. }
  230.  
  231.  
  232. ODBoolean
  233. TempODWindowIterator::IsNotComplete( )
  234. {
  235.     return ((ODWindowIterator*)fObj)->IsNotComplete(fEv);
  236. }
  237.  
  238.  
  239. //=====================================================================================
  240. // TempODDragItemIterator
  241. //=====================================================================================
  242.  
  243. #ifdef _OD_IMPL_
  244.  
  245. TempODDragItemIterator::TempODDragItemIterator( Environment *ev, ODDragAndDrop *d )
  246.     :BaseTempObj(),
  247.      fEv(ev)
  248. {
  249.     fObj = kODNULL;
  250.     fObj = d->GetDragItemIterator(ev);
  251.     this->First();
  252. }
  253.  
  254.  
  255. ODStorageUnit*
  256. TempODDragItemIterator::First( )
  257. {
  258.     return fCurrent = ((ODDragItemIterator*)fObj)->First(fEv);
  259. }
  260.  
  261.  
  262. ODStorageUnit*
  263. TempODDragItemIterator::Next( )
  264. {
  265.     return fCurrent = ((ODDragItemIterator*)fObj)->Next(fEv);
  266. }
  267.  
  268.  
  269. ODBoolean
  270. TempODDragItemIterator::IsNotComplete( )
  271. {
  272.     return ((ODDragItemIterator*)fObj)->IsNotComplete(fEv);
  273. }
  274.  
  275. #endif /*_OD_IMPL_*/
  276.  
  277.  
  278. //=====================================================================================
  279. // TempODFocusSetIterator
  280. //=====================================================================================
  281.  
  282. TempODFocusSetIterator::TempODFocusSetIterator( Environment *ev, ODFocusSet *fs )
  283.     :BaseTempObj(),
  284.      fEv(ev)
  285. {
  286.     fObj = kODNULL;
  287.     fObj = fs->CreateIterator(ev);
  288.     this->First();
  289. }
  290.  
  291.  
  292. ODTypeToken
  293. TempODFocusSetIterator::First( )
  294. {
  295.     return fCurrent = ((ODFocusSetIterator*)fObj)->First(fEv);
  296. }
  297.  
  298.  
  299. ODTypeToken
  300. TempODFocusSetIterator::Next( )
  301. {
  302.     return fCurrent = ((ODFocusSetIterator*)fObj)->Next(fEv);
  303. }
  304.  
  305.  
  306. ODBoolean
  307. TempODFocusSetIterator::IsNotComplete( )
  308. {
  309.     return ((ODFocusSetIterator*)fObj)->IsNotComplete(fEv);
  310. }
  311.  
  312.  
  313. //=====================================================================================
  314. // TempODTypeListIterator
  315. //         ODTypeListIterator returns copies of the data, which must be disposed.
  316. //=====================================================================================
  317.  
  318. TempODTypeListIterator::TempODTypeListIterator( Environment *ev, ODTypeList *t )
  319.     :BaseTempObj(),
  320.      fEv(ev),
  321.      fCurrent(kODNULL)
  322. {
  323.     fObj = kODNULL;
  324.     fObj = t->CreateTypeListIterator(ev);
  325.     this->First();
  326. }
  327.  
  328.  
  329. TempODTypeListIterator::~TempODTypeListIterator( )
  330. {
  331.     ODDisposePtr(fCurrent); fCurrent = kODNULL;
  332. }
  333.  
  334.  
  335. ODType
  336. TempODTypeListIterator::First( )
  337. {
  338.     ODDisposePtr(fCurrent); fCurrent = kODNULL;
  339.     return fCurrent = ((ODTypeListIterator*)fObj)->First(fEv);
  340. }
  341.  
  342.  
  343. ODType
  344. TempODTypeListIterator::Next( )
  345. {
  346.     ODDisposePtr(fCurrent); fCurrent = kODNULL;
  347.     return fCurrent = ((ODTypeListIterator*)fObj)->Next(fEv);
  348. }
  349.  
  350.  
  351. ODBoolean
  352. TempODTypeListIterator::IsNotComplete( )
  353. {
  354.     return ((ODTypeListIterator*)fObj)->IsNotComplete(fEv);
  355. }
  356.